package com.example.rocket.controller;

import lombok.extern.slf4j.Slf4j;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;

/**
 * @Author ifredomvip@gmail.com
 * @Date 2022/8/16 16:12
 * @Version 1.0.0
 * @Description
 **/
@Slf4j
@Component
@RocketMQMessageListener(consumerGroup = "string-consumer", topic = "topic-string",selectorExpression = "topic-string")
public class ConsumerStringMessage implements RocketMQListener<String> {
    @Override
    public void onMessage(String message) {
        // 重写消息处理方法
        log.info("------- StringConsumer received:{} \n", message);
        // 对消息进行处理，比如写入数据
    }
}
